package study;

import space.position.Point;

/**
 * Object类
 * 所有类的鼻祖
 * 即所有类都直接或间接继承Object类
 * */
public class ObjectDemo {
    public static void main(String[] args) {
        Point point = new Point(10, 30);
        Point point2 = new Point(10, 30);
        System.out.println(point.toString());
        System.out.println(point == point2);        // 比较地址
        System.out.println(point.equals(point2));   // 默认比较地址，可重写equals()方法比较其属性值
        point2 = null;
        System.out.println(point.equals(point2));
    }
}
